import {
	fetchUserInfo
} from '@/api/user';
import {
	ref,
	onMounted
} from 'vue';

export const useUser = (cb) => {
	const user = ref();

	const getUser = async () => {
		const res = await fetchUserInfo();
		if (res.data) {
			user.value = res.data;
			cb && cb(user.value);
		}
	}
	onMounted(() => {
		getUser();
	})


	return [user];

}